﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
		xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
		xmlns:Primitives="clr-namespace:Microsoft.Windows.Controls.Ribbon.Primitives;assembly=RibbonControlsLibrary"
		xmlns:Ribbon="clr-namespace:Microsoft.Windows.Controls.Ribbon;assembly=RibbonControlsLibrary"
		xmlns:ext="clr-namespace:Microsoft.Windows.Shell;assembly=Microsoft.Windows.Shell"
		xmlns:System="clr-namespace:System;assembly=mscorlib">
	<Style TargetType="Ribbon:RibbonQuickAccessToolBar">
		<Setter Property="Background" Value="{DynamicResource White}" />
		<Setter Property="Template">
			<Setter.Value>
				<ControlTemplate TargetType="{x:Type Ribbon:RibbonQuickAccessToolBar}">
					<Grid Margin="{TemplateBinding Margin}" SnapsToDevicePixels="True">
						<Grid.ColumnDefinitions>
							<ColumnDefinition Width="*" />
							<ColumnDefinition Width="1" />
							<ColumnDefinition Width="Auto" />
						</Grid.ColumnDefinitions>
						<Primitives:RibbonQuickAccessToolBarPanel x:Name="PART_MainPanel" Grid.Column="0"
								IsItemsHost="True" />
						<ContentPresenter x:Name="MainCustomizeMenuHost"
								Content="{Binding CustomizeMenuButton, RelativeSource={RelativeSource TemplatedParent}}"
								Grid.Column="2" />
						<Grid x:Name="OverflowButtonHost" Grid.Column="2" Visibility="Collapsed">
							<Ribbon:RibbonToggleButton x:Name="PART_OverflowButton" ClickMode="Press"
									IsChecked="{Binding IsOverflowOpen, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}"
									KeyTip="00" Width="12">
								<Ribbon:RibbonToggleButton.ControlSizeDefinition>
									<Ribbon:RibbonControlSizeDefinition IsLabelVisible="True" ImageSize="Collapsed" />
								</Ribbon:RibbonToggleButton.ControlSizeDefinition>
								<Ribbon:RibbonToggleButton.Style>
									<Style TargetType="{x:Type Ribbon:RibbonToggleButton}">
										<Setter Property="BorderThickness" Value="1" />
										<Setter Property="Template">
											<Setter.Value>
												<ControlTemplate TargetType="Ribbon:RibbonToggleButton">
													<Grid x:Name="MainGrid" SnapsToDevicePixels="True">
														<Border x:Name="OuterBorder"
																BorderBrush="{TemplateBinding BorderBrush}"
																BorderThickness="{TemplateBinding BorderThickness}"
																Background="{TemplateBinding Background}" />
														<StackPanel x:Name="StackPanel"
																HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}">
															<Image x:Name="PART_Image"
																	RenderOptions.BitmapScalingMode="NearestNeighbor"
																	HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
																	Height="32" Margin="1,1,1,2"
																	Source="{TemplateBinding LargeImageSource}"
																	VerticalAlignment="Center" Width="32" />
															<Grid x:Name="Grid" HorizontalAlignment="Center"
																	VerticalAlignment="Center">
																<Ribbon:RibbonTwoLineText x:Name="TwoLineText"
																		HorizontalAlignment="Center"
																		LineStackingStrategy="BlockLineHeight"
																		LineHeight="13" Margin="1,1,1,0"
																		TextAlignment="Center"
																		Text="{TemplateBinding Label}"
																		VerticalAlignment="Top" />
															</Grid>
														</StackPanel>
													</Grid>
													<ControlTemplate.Triggers>
														<DataTrigger
																Binding="{Binding ControlSizeDefinition.ImageSize, RelativeSource={RelativeSource Self}}"
																Value="Large">
															<Setter Property="MinWidth" Value="42" />
															<Setter Property="Height" Value="69" />
															<Setter Property="MinHeight" TargetName="Grid" Value="26" />
															<Setter Property="Ribbon:RibbonTwoLineText.HasTwoLines"
																	TargetName="TwoLineText" Value="True" />
														</DataTrigger>
														<DataTrigger
																Binding="{Binding ControlSizeDefinition.ImageSize, RelativeSource={RelativeSource Self}}"
																Value="Small">
															<Setter Property="Height" Value="22" />
															<Setter Property="Margin" TargetName="PART_Image"
																	Value="1,0" />
															<Setter Property="Source" TargetName="PART_Image"
																	Value="{Binding SmallImageSource, RelativeSource={RelativeSource TemplatedParent}}" />
															<Setter Property="Width" TargetName="PART_Image" Value="16" />
															<Setter Property="Height" TargetName="PART_Image" Value="16" />
															<Setter Property="HorizontalAlignment"
																	TargetName="TwoLineText" Value="Left" />
															<Setter Property="Margin" TargetName="TwoLineText" Value="1" />
															<Setter Property="Orientation" TargetName="StackPanel"
																	Value="Horizontal" />
														</DataTrigger>
														<DataTrigger
																Binding="{Binding ControlSizeDefinition.IsLabelVisible, RelativeSource={RelativeSource Self}}"
																Value="False">
															<Setter Property="Text" TargetName="TwoLineText"
																	Value="{x:Null}" />
															<Setter Property="Margin" TargetName="TwoLineText" Value="0" />
														</DataTrigger>
														<DataTrigger
																Binding="{Binding ControlSizeDefinition.ImageSize, RelativeSource={RelativeSource Self}}"
																Value="Collapsed">
															<Setter Property="Visibility" TargetName="PART_Image"
																	Value="Collapsed" />
														</DataTrigger>
														<Trigger Property="IsMouseOver" Value="True">
															<Setter Property="Background" TargetName="OuterBorder"
																	Value="{Binding MouseOverBackground, RelativeSource={RelativeSource TemplatedParent}}" />
															<Setter Property="BorderBrush" TargetName="OuterBorder"
																	Value="{Binding MouseOverBorderBrush, RelativeSource={RelativeSource TemplatedParent}}" />
														</Trigger>
														<Trigger Property="IsKeyboardFocused" Value="True">
															<Setter Property="Background" TargetName="OuterBorder"
																	Value="{Binding FocusedBackground, RelativeSource={RelativeSource TemplatedParent}}" />
															<Setter Property="BorderBrush" TargetName="OuterBorder"
																	Value="{Binding FocusedBorderBrush, RelativeSource={RelativeSource TemplatedParent}}" />
														</Trigger>
														<Trigger Property="IsChecked" Value="True">
															<Setter Property="Background" TargetName="OuterBorder"
																	Value="{Binding CheckedBackground, RelativeSource={RelativeSource TemplatedParent}}" />
															<Setter Property="BorderBrush" TargetName="OuterBorder"
																	Value="{Binding CheckedBorderBrush, RelativeSource={RelativeSource TemplatedParent}}" />
														</Trigger>
														<Trigger Property="IsPressed" Value="True">
															<Setter Property="Background" TargetName="OuterBorder"
																	Value="{Binding PressedBackground, RelativeSource={RelativeSource TemplatedParent}}" />
															<Setter Property="BorderBrush" TargetName="OuterBorder"
																	Value="{Binding PressedBorderBrush, RelativeSource={RelativeSource TemplatedParent}}" />
														</Trigger>
														<MultiDataTrigger>
															<MultiDataTrigger.Conditions>
																<Condition
																		Binding="{Binding IsMouseOver, RelativeSource={RelativeSource Self}}"
																		Value="True" />
																<Condition
																		Binding="{Binding IsChecked, RelativeSource={RelativeSource Self}}"
																		Value="True" />
																<Condition
																		Binding="{Binding IsPressed, RelativeSource={RelativeSource Self}}"
																		Value="False" />
															</MultiDataTrigger.Conditions>
															<Setter Property="Background" TargetName="OuterBorder"
																	Value="{Binding MouseOverBackground, RelativeSource={RelativeSource TemplatedParent}}" />
														</MultiDataTrigger>
														<Trigger Property="IsInControlGroup" Value="True">
															<Setter Property="BorderBrush" TargetName="OuterBorder"
																	Value="{Binding Ribbon.BorderBrush, RelativeSource={RelativeSource TemplatedParent}}" />
															<Setter Property="BorderThickness" TargetName="OuterBorder"
																	Value="0,0,1,0" />
														</Trigger>
														<Trigger Property="IsEnabled" Value="False">
															<Setter Property="Opacity" TargetName="PART_Image"
																	Value="0.5" />
															<Setter Property="TextElement.Foreground"
																	TargetName="MainGrid" Value="#FF9E9E9E" />
															<Setter Property="PathFill" TargetName="TwoLineText"
																	Value="#FF9E9E9E" />
															<Setter Property="Background" TargetName="OuterBorder"
																	Value="{Binding Background, RelativeSource={RelativeSource TemplatedParent}}" />
															<Setter Property="BorderBrush" TargetName="OuterBorder"
																	Value="{Binding BorderBrush, RelativeSource={RelativeSource TemplatedParent}}" />
														</Trigger>
													</ControlTemplate.Triggers>
												</ControlTemplate>
											</Setter.Value>
										</Setter>
									</Style>
								</Ribbon:RibbonToggleButton.Style>
							</Ribbon:RibbonToggleButton>
							<Path Data="M0,0L2,2 0,4 M4,0L6,2 4,4" Fill="{TemplateBinding Foreground}"
									HorizontalAlignment="Center" Height="5" IsHitTestVisible="False" Margin="1,0,0,0"
									Stretch="Fill" Stroke="{TemplateBinding Foreground}" VerticalAlignment="Center"
									Width="7" />
							<Popup x:Name="PART_OverflowPopup" AllowsTransparency="True" Focusable="False"
									IsOpen="{Binding IsOverflowOpen, RelativeSource={RelativeSource TemplatedParent}}"
									PopupAnimation="{DynamicResource {x:Static SystemParameters.MenuPopupAnimationKey}}"
									Placement="Bottom">
								<Border x:Name="PopupBorder" BorderBrush="{TemplateBinding BorderBrush}"
										BorderThickness="1" Background="{TemplateBinding Background}" Padding="2">
									<DockPanel>
										<Primitives:RibbonQuickAccessToolBarOverflowPanel x:Name="PART_OverflowPanel"
												KeyboardNavigation.DirectionalNavigation="Cycle"
												KeyboardNavigation.TabNavigation="Cycle" />
										<ContentPresenter x:Name="OverflowCustomizeMenuHost" DockPanel.Dock="Right" />
									</DockPanel>
								</Border>
							</Popup>
						</Grid>
					</Grid>
					<ControlTemplate.Triggers>
						<DataTrigger
								Binding="{Binding ShowQuickAccessToolBarOnTop, RelativeSource={RelativeSource FindAncestor, AncestorLevel=1, AncestorType={x:Type Ribbon:Ribbon}}}"
								Value="false">
							<Setter Property="Margin" TargetName="PART_MainPanel" Value="2,0" />
						</DataTrigger>
						<Trigger Property="HasOverflowItems" Value="True">
							<Setter Property="Visibility" TargetName="OverflowButtonHost" Value="Visible" />
							<Setter Property="Content" TargetName="MainCustomizeMenuHost" Value="{x:Null}" />
							<Setter Property="Content" TargetName="OverflowCustomizeMenuHost"
									Value="{Binding CustomizeMenuButton, RelativeSource={RelativeSource TemplatedParent}}" />
						</Trigger>
						<Trigger Property="IsOpen" SourceName="PART_OverflowPopup" Value="False">
							<Setter Property="PopupAnimation" TargetName="PART_OverflowPopup" Value="None" />
						</Trigger>
						<DataTrigger Binding="{Binding HighContrast}" Value="True">
							<Setter Property="PopupAnimation" TargetName="PART_OverflowPopup" Value="None" />
							<Setter Property="BorderBrush" TargetName="PopupBorder"
									Value="{DynamicResource {x:Static SystemColors.ControlDarkBrushKey}}" />
							<Setter Property="Background" TargetName="PopupBorder"
									Value="{DynamicResource {x:Static SystemColors.ControlBrushKey}}" />
						</DataTrigger>
					</ControlTemplate.Triggers>
				</ControlTemplate>
			</Setter.Value>
		</Setter>
	</Style>
</ResourceDictionary>